Add support for Holux GR245 waypoints.
authorrobertl <robertl>
Mon, 7 Sep 2009 21:23:06 +0000 (21:23 +0000)
committerrobertl <robertl>
Mon, 7 Sep 2009 21:23:06 +0000 (21:23 +0000)
mtk_logger.c

index 32fd76a3c7ee78961c240c1a42ccd9640c7f2a52..dec0cba476ac1659f00e1d21cccb04f567a6b418 100644 (file)
@@ -113,6 +113,7 @@ static const char *MTK_ACK[] = { /* Flags returned from PMTK001 ack packet */
 #define MTK_EVT_DISTANCE (1<<0x04)
 #define MTK_EVT_SPEED    (1<<0x05)
 #define MTK_EVT_START    (1<<0x07)
+#define MTK_EVT_WAYPT    (1<<0x10)  /* Holux waypoint follows... */
 
 /* *************************************** */
 
@@ -761,8 +762,12 @@ static int add_trackpoint(int idx, unsigned long bmask, struct data_item *itm){
        trk->sat = itm->sat_used;
 
     // RCR is a bitmask of possibly several log reasons..
+    // Holux devics use a Event prefix for each waypt. 
     if ( global_opts.masked_objective & WPTDATAMASK
-       && bmask & (1<<RCR) && itm->rcr & 0x0008  )
+       && (   (bmask & (1<<RCR) && itm->rcr & 0x0008) 
+            || (mtk_info.track_event & MTK_EVT_WAYPT)
+          )
+       )
     {
        /* Button press -- create waypoint, start count at 1 */
        waypoint *w = waypt_dupe(trk);
@@ -1230,7 +1235,7 @@ static int mtk_log_len(unsigned int bitmask){
    }
    for (i=0;i<32;i++){
       if ( (1<<i) & bitmask ){
-         if ( i > DISTANCE )
+         if ( i > DISTANCE && global_opts.debug_level > 0 )
             warning(MYNAME ": Unknown size/meaning of bit %d\n", i);
          if ( (i == SID || i == ELEVATION || i == AZIMUTH || i == SNR) && (1<<SID) & bitmask )
             len += log_type[i].size*32; // worst case, max sat. count..
@@ -1389,6 +1394,9 @@ static void file_read(void) {
             mtk_parse_info(&buf[i], (bLen-i));
             k = 16;
          } else if  ( is_holux_string(&buf[i], (bLen - i)) ) {
+            if ( memcmp(&buf[i+10], "WAYPNT", 6) == 0 )
+               mtk_info.track_event |= MTK_EVT_WAYPT;
+
             k = 16;
             // m241  - HOLUXGR241LOGGER or HOLUXGR241WAYPNT
             // gr245 - HOLUXGR245LOGGER<SP><SP><SP><SP> or HOLUXGR245WAYPNT<SP><SP><SP><SP>